package com.cos.lession72.slice;

import com.cos.lession72.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.TabList;

public class TabListAbilitySlice extends AbilitySlice {


    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_ability_tablist);

        TabList tl  = (TabList) findComponentById(ResourceTable.Id_tab_list);
        //创建标签项
        TabList.Tab t1 = tl.new Tab(getContext());
        //设置标签名字
        t1.setText("Home");
        //加入表列表当中
        tl.addTab(t1);        //创建标签项
        TabList.Tab t2 = tl.new Tab(getContext());
        //设置标签名字
        t2.setText("Product");
        //加入表列表当中
        tl.addTab(t2);        //创建标签项
        TabList.Tab t3 = tl.new Tab(getContext());
        //设置标签名字
        t3.setText("Email");
        //加入表列表当中
        tl.addTab(t3);
        TabList.Tab t4 = tl.new Tab(getContext());
        //设置标签名字
        t4.setText("Phone");
        //加入表列表当中
        tl.addTab(t4);
        tl.setFixedMode(true);
    }
}
